{extend name="public:layout" /}
{block name="title"}模型字段管理{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> <a href="{:url('moudle/index')}"> 模型管理</a></li>
                <li class="active">字段列表</li>
            </ol>
        </div>
        <div class="ibox-content">
            <form method="post" action="{:url('updateSort',['mid'=>$mid])}">
                <div class="toolbar">
                    <div class="pull-left">
                        <button type="submit" class="btn btn-white">
                            <i class="fa fa-sort"></i>更新排序
                        </button>
                        <a class="btn btn-primary" href="{:url('add',['mid'=>$mid])}">
                            <i class="fa fa-plus"></i>&nbsp;添加字段
                        </a>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th width="60">排序</th>
                        <th>模型表名</th>
                        <th>字段标题</th>
                        <th>字段名</th>
                        <th>字段类型</th>
                        <th>系统</th>
                        <th width="120">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="list" id="vo"}
                    <tr>
                        <td>
                            <input type="text" class="form-control input-sm" style="width:50px;"
                                   name="fieldSort[{$vo.fid}]" value="{$vo.field_sort}"
                                   datatype="n" nullmsg="请填写排序字段！" errormsg="排序字段必须为数字"/>
                        </td>
                        <td>{$vo.table_name}</td>
                        <td>{$vo.title}</td>
                        <td>{$vo.field_name}</td>
                        <td>{$vo.field_type}</td>
                        <td>{$vo.is_system_text}</td>
                        <td>
                            {in name="vo.field_name" value="$noAllowEdit"}
                            <span class="disable">编辑</span>
                            {else/}
                            <a href="{:url('edit',['fid'=>$vo['fid']])}">编辑</a>
                            {/in}
                            {eq name="vo.enable" value="1"}
                            <a href="{:url('forbidden',['fid'=>$vo['fid'],'enable'=>0,'mid'=>$mid])}">禁用</a>
                            {else/}
                            <a href="{:url('forbidden',['fid'=>$vo['fid'],'enable'=>1,'mid'=>$mid])}">启用</a>
                            {/eq}
                            {in name="vo.field_name" value="$noAllowDelete"}
                            <span class="disable">删除</span>
                            {else/}
                            <a href="javascript:;" onclick="doAction(this);"
                               data-msg="确认删除吗？" data-url="{:url('del')}" data-params="fid={$vo.fid}&mid={$mid}">删除</a>
                            {/in}
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                <div class="clearfix"></div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}{/block}